#include <QGuiApplication>
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QApplicationStatic>
#include <QChronoTimer>
#include  <QtQuick>
#include "imageprovider.cpp"
#include "myplugin.h"

int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

    QGuiApplication app(argc, argv);
    QQmlApplicationEngine engine;
    //注册模型
    registerTypes();

    QQuickView view;
    view.setResizeMode(QQuickView::SizeRootObjectToView);

    // 注册 Image Provider 到引擎
    view.engine()->addImageProvider("colors", new ColorImageProvider);

    //引入本地创建的插件
    view.engine()->addImportPath(QStringLiteral("../plugin2"));
        //QCoreApplication::applicationDirPath() + "/../plugin2");


    // 在测试项目的main.cpp中添加
    qDebug() << view.engine()->pluginPathList();

    //状态转换
    //view.setSource(QUrl("qrc:/StatusTransition.qml"));
    //创建游戏画布
    //view.setSource(QUrl("qrc:/createGameCanvasAndPiece.qml"));
    //简单示例
    view.setSource( QUrl("qrc:/simple/TextSimple.qml") );
    view.show();


    return app.exec();
}
